#include <math.h>
#include <stdio.h>
#include "printer.h"
#include "_cgo_export.h"

CallBackFn_t cb = NULL;
RecvMsgFn_t recvMsgCb = NULL;

void setCallBack(CallBackFn_t fn)
{
    cb = fn;
}

void briderFn(int v)
{
    printf("callback %d\n", v);
    if(cb != NULL)
    {
        cb(v);
    }else{
        printf("回调函数没有设置");
    }
}

void printPiJSON()
{
    printf("%s\n", EncodeF64("PI", M_PI));
}

void setRecvMsgFn(RecvMsgFn_t fn)
{
    recvMsgCb = fn;
}

void RecvMsgBrider(int msgId, unsigned char *buf, int len)
{
     printf("msgId %d\n", msgId);
    if(recvMsgCb != NULL)
    {
        recvMsgCb(msgId, buf, len);
    }else{
        printf("回调函数没有设置");
    }
}

